package com.sam4cloud.auth.project.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @Author: Sam
 * @Date: 2022-11-15 09:32
 * @Description: 登录的用户信息类
 */
@Getter
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class LoginUser extends User {


    @ApiModelProperty(value = "id")
    private String id;

    @ApiModelProperty(value = "部门id")
    private String deptId;

    @ApiModelProperty(value = "角色id")
    private String roleId;

    public LoginUser(String id, String deptId, String roleId, String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.id = id;
        this.deptId = deptId;
        this.roleId = roleId;
    }

    public LoginUser(String id, String deptId, String roleId, String username, String password, boolean enabled,
                     boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
        this.deptId = deptId;
        this.roleId = roleId;
    }
}
